<%@page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%@page import="java.util.*"%>
<%@page import="com.srit.core.bean.Page" %>
<%@page import="com.srit.map.business.bean.Company" %>

<html>
<head>
<style type="text/css">
body, html {width: 100%;height: 100%;overflow: hidden;margin:0;float:left}
#head{}
#allmap{width: 80%;height: 100%;overflow: hidden;margin:0;float:left}
#right{width:auto; height: 100%;overflow: hidden;margin:0;float:left}
#l-map{height:100%;width:78%;float:left;border-right:2px solid #bcbcbc;}
#r-result{height:100%;width:20%;float:left;}
</style>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=1.3"></script>
<%
Page pages=(Page)request.getAttribute("page");
List<Company> companyList = pages.getList();
int len=companyList.size();
if(len > 10){
	len=10;
}
%>

<title>鄞州工业地图</title>
</head>
<body>
<div class="head"></div>
<div>
<div id="allmap"></div>
<div id="right"><%=len %>个搜索结果
<%for(int j = 0; j < len; j ++) {
	%>
	<div> <%=companyList.get(j).getName() %></div>
	<% 
}%>
</div>
</div>
</body>
</html>
<script type="text/javascript">
var map = new BMap.Map("allmap");
var point = new BMap.Point(121.553433,29.8234865);
map.centerAndZoom(point, 12);
// 编写自定义函数,创建标注
//function addMarker(point){
  //var myIcon = new BMap.Icon("./image/markers.png", new BMap.Size(19,25));
  //myIcon.setImageOffset(new BMap.Size(0,-25));
  //var marker = new BMap.Marker(point,{icon:myIcon});
  //map.addOverlay(marker);
//}
// 随机向地图添加25个标注
//var bounds = map.getBounds();
//var sw = bounds.getSouthWest();
//var ne = bounds.getNorthEast();
//var lngSpan = Math.abs(sw.lng - ne.lng);
//var latSpan = Math.abs(ne.lat - sw.lat);
<%

for(int i = 0; i < len; i ++) {%>
	var x='<%=companyList.get(i).getPost_long()%>';
	var y='<%=companyList.get(i).getPost_lat()%>';
	//alert(x+","+y)
	var j=<%=i%>*(-25);
	//alert(j);
 	var point = new BMap.Point(x, y);
 	var myIcon = new BMap.Icon("./image/markers.png", new BMap.Size(19,25));
 	myIcon.setAnchor(new BMap.Size(9.5,25));
 	myIcon.setImageOffset(new BMap.Size(0,j));
 	var marker = new BMap.Marker(point,{icon:myIcon});
 	map.addOverlay(marker);
<%
}
%>
</script>
